﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Cusdoc.aspx.cs" Inherits="Cusdoc" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <%if (Request.QueryString["action"] != "export")
      { %>
    <!--#include virtual="include/Head.ascx"-->
    <link rel="stylesheet" type="text/css" href="assets/css/datepicker.css" />
    <script type='text/javascript' src="assets/js/jquery.ui.datepicker.js"></script>
    <script type='text/javascript' src="assets/js/Ports.js"></script>
    <script type="text/javascript">

        function doDelete(strID, strName) {
            if (confirm('Bạn có thực sự muốn xóa ' + strName + '?')) {
                var vnpage = getUrlVars()['page_number'];
                var vChar = getUrlVars()['letter'];
                var strHref = "";
                if (vnpage)
                    strHref = "Cusdoc.aspx?action=delete&ID=" + strID + "&page_number=" + vnpage;
                else
                    strHref = "Cusdoc.aspx?action=delete&ID=" + strID;

                if (vChar)
                    window.location.href = strHref + "&letter=" + vChar;
                else
                    window.location.href = strHref;
            }
        }
        function doEdit(strID, strFileNo) {
            var vnpage = getUrlVars()['page_number'];
            if (vnpage)
                url = "CreateCusDoc.aspx?id=" + strID + "&page_number=" + vnpage;
            else
                url = "CreateCusDoc.aspx?id=" + strID;
            window.location.href = url;
            //var win=window.open(url, '_blank');
            //win.focus();
        }
        function doViewBill(billID, action) {
            window.open("./Bill.View.aspx?action=" + action + "&ID=" + billID, "mywindow", "menubar=0,status=0,directories=0,resizable=1,scrollbars=1,width=1000,height=600");
        }
        function doOpenDocReport(cusdocID, action) {
            if (action == "shippinginstruction")
                window.open("./ShippingInstruction.aspx?ID=" + cusdocID, "ShippingInstruction", "menubar=0,status=0,directories=0,resizable=1,scrollbars=1,width=1000,height=600");
            else if (action == "transhipmentreport")
                window.open("./TranshipmentReport.aspx?ID=" + cusdocID, "TranshipmentReport", "menubar=0,status=0,directories=0,resizable=1,scrollbars=1,width=1000,height=600");
            else if (action == "arrialreport")
                window.open("./ArrialReport.aspx?ID=" + cusdocID, "ArrialReport", "menubar=0,status=0,directories=0,resizable=1,scrollbars=1,width=1000,height=600");

        }
        $(function () {
            $('#txtSearchPOL').focus().autocomplete(ports);
            $('#txtSearchDEST').focus().autocomplete(ports);
            $("#txtFrom").datepicker({ dateFormat: "dd-mm-yy" });
            $("#txtTo").datepicker({ dateFormat: "dd-mm-yy" });
            $("#btnExport").click(function () {
                openwindowExport();
            });
            $("#btnLIFTING").click(function () {
                window.open("./CusDoc.Lifting.aspx", "DocLifting", "menubar=0,status=0,directories=0,resizable=1,scrollbars=1,width=720,height=500");
            });

        });
        function openwindowExport() {
            window.open("./Cusdoc.aspx?action=export", "ComSaleReport", "menubar=0,status=0,directories=0,resizable=1,scrollbars=1,width=720,height=500");
        }
    </script>
    <%}
      else
      { %>
    <style type="text/css">
        .thheader {
            font-weight: bold;
            vertical-align: middle;
            text-align: center;
            font-size: 11px;
            border: 1px solid #ccc !important;
            line-height: 7px !important;
            ;
        }

        .totalamount {
            font-weight: bold;
        }
    </style>
    <style type="text/css">
        html {
            font-size: 100%;
            height: 100%;
            margin-bottom: 1px; /* Always show a scrollbar to avoid jumping when the scrollbar appears  */
        }

        body {
            font-family: Arial, Helvetica, sans-serif;
            color: #555;
            background: #fff;
            font-size: 12px;
        }

        a {
            color: #57a000;
            text-decoration: none;
        }

            a:hover {
                color: #000;
            }

            a:active {
                color: #777;
            }

            a:focus {
                outline: 1px;
            }

        table {
            border-collapse: collaspe;
            border: 1px solid #fff;
            border-bottom: 1px solid #fff;
            border-right: 1px solid #fff;
            border-left: 1px solid #fff;
        }

        td {
            border-collapse: collapse;
            border: 1px solid #fff;
            border-bottom: 1px solid #fff;
            border-right: 1px solid #fff;
            border-left: 1px solid #fff;
        }

        .normal {
            border-collapse: collapse;
            border: 1px solid #fff;
        }

        table.adminlist {
            background-color: #fff;
            border-collapse: collapse;
            border-left: 1px solid #CCCCCC;
            border-top: 1px solid #CCCCCC;
            border-right: 1px solid #CCCCCC;
            border-bottom: 1px solid #CCCCCC;
            color: #666666;
            font-size: 12px;
            width: 100%;
        }

            table.adminlist td, table.adminlist th {
                padding: 3px !important;
                background-color: #fff;
            }

            table.adminlist td, table.adminlist th {
                border-bottom: 1px solid #CCCCCC;
                border-right: 1px solid #CCCCCC;
                border-left: 1px solid #CCCCCC;
            }

            table.adminlist thead, table.adminlist th {
                padding: 3px !important;
                background-color: #ECECEC;
            }

        @media screen, projection {
            span.pseudolink {
                color: Blue;
                text-decoration: underline;
                font-size: 10pt;
                font-family: Tahoma;
                cursor: hand;
            }

            header, footer {
                display: none;
            }

            @media print {
                span.pseudolink {
                    display: none;
                }

                header, footer {
                    display: none;
                }
            }

            .hideifnoscript {
                display: none;
            }

            .wrapword {
                white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */
                white-space: -pre-wrap; /* Opera 4-6 */
                white-space: -o-pre-wrap; /* Opera 7 */
                white-space: pre-wrap; /* css-3 */
                word-wrap: break-word; /* Internet Explorer 5.5+ */
                word-break: break-all;
                white-space: normal;
            }
    </style>
    <%} %>
</head>
<body>
    <div id="body-wrapper">
        <%if (Request.QueryString["action"]!="export"){ %>
        <div id="header">
            <!--#include virtual="include/top.ascx"-->
        </div>
        <%} %>
        <div id="main-content1">
            <h2>DOC LIST:
                <% =Province%>
            </h2>
            <div class="clear">
            </div>
            <div class="content-box">
                <form id="frmEdit" runat="server">
                    <div class="content-box-header">
                        <%if (Request.QueryString["action"]!="export"){ %>
                        <%-- <h3 style="cursor: s-resize;">
                    </h3>--%>
                        <asp:DropDownList ID="ddCusWarning" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddCusWarning_Selected">
                            <asp:ListItem Text="Mixed" Value="-1"></asp:ListItem>
                            <asp:ListItem Text="Blue" Value="0"></asp:ListItem>
                            <asp:ListItem Text="Red" Value="1"></asp:ListItem>
                        </asp:DropDownList>
                        <%if (nPermissions > 7)
                      { %>
                        <asp:DropDownList ID="ddProvince" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddProvince_SelectedIndexChanged">
                        </asp:DropDownList>
                        <%} %>
                    &nbsp; Find:
                    <asp:TextBox ID="keyword" Text="" runat="server"></asp:TextBox>
                        By:
                    <asp:DropDownList ID="ddType" runat="server">
                        <asp:ListItem Text="File Number" Value="FILENO"></asp:ListItem>
                        <asp:ListItem Text="MBL No" Value="MBLNO"></asp:ListItem>
                        <asp:ListItem Text="HBL No" Value="HBLNO"></asp:ListItem>
                        <asp:ListItem Text="SHPR" Value="HBLSHPR"></asp:ListItem>
                        <asp:ListItem Text="CNEE" Value="HBLCNEE"></asp:ListItem>
                        <asp:ListItem Text="CARRIER" Value="CARRCODE"></asp:ListItem>
                        <asp:ListItem Text="CTR.NAME" Value="CTRNAME"></asp:ListItem>
                    </asp:DropDownList>
                        Pol:
                    <asp:TextBox ID="txtSearchPOL" runat="server" Width="120px"></asp:TextBox>
                        Dest:
                    <asp:TextBox ID="txtSearchDEST" runat="server" Width="120px"></asp:TextBox>
                        From:
                    <asp:TextBox ID="txtFrom" CssClass="calendar-icon" runat="server" value="From" onclick="if(this.value=='From'){this.value=''; this.style.color='#000'}"
                        onblur="if(this.value==''){this.value='From'; this.style.color='#555'}" Width="80px"></asp:TextBox>
                        To:
                    <asp:TextBox ID="txtTo" CssClass="calendar-icon" runat="server" value="To" Width="80px"
                        onclick="if(this.value=='To'){this.value=''; this.style.color='#000'}" onblur="if(this.value==''){this.value='To'; this.style.color='#555'}"></asp:TextBox>
                        <asp:Button ID="btnSearch" Text="Search" runat="server" CssClass="button" Style="margin: 9px 10px;"
                            OnClick="btnSearch_Click" />
                        <input id="btnAddNew" type="button" style="float: right; margin: 9px 2px;" class="button"
                            value="Add new" runat="server" onserverclick="btnAddNew_ServerClick" />
                        <%if (nPermissions > 7)
                      { %>
                        <input id="btnExport" type="button" style="float: right; margin: 9px 2px;" class="button"
                            value="&nbsp;Export&nbsp;" />
                        <input id="btnLIFTING" type="button" style="float: right; margin: 9px 2px;" class="button"
                            value="&nbsp;Lifting &nbsp;" />
                        <%} %>
                        <%} %>
                        <div class="clear">
                        </div>
                    </div>
                    <asp:Repeater ID="rptData" runat="server">
                        <ItemTemplate>
                            <tr onmouseover="this.style.background='#dbf0c9'" onmouseout="this.style.background='#ffffff'"
                                cusdocid='<%#Eval("ID") %>'>
                                <td width="30px">
                                    <%#Eval("INDEX")%>
                                </td>
                                <td width="50px">
                                    <%#Eval("FILENO")%>
                                </td>
                                <%-- <td width="50px">
                                <%#Eval("MBKGNO")%>
                            </td>--%>
                                <td width="50px">
                                    <%#Eval("MBLNO")%>
                                </td>
                                <td width="50px">
                                    <%#Eval("BILLTYPE")%>
                                </td>
                                <td width="70px">
                                    <%#Eval("VOL")%>
                                </td>
                                <td width="70px">
                                    <%#Eval("POLNAME")%>
                                </td>
                                <td width="70px">
                                    <%#Eval("DESTNAME")%>
                                </td>
                                <td width="70px">
                                    <%#Eval("SHONBOARD")%>
                                </td>
                                <td width="70px">
                                    <%#Eval("ETA")%>
                                </td>
                                <%-- <td width="50px">
                                <%#Eval("HBLNO")%>
                            </td>--%>
                                <td width="150px">
                                    <%#Eval("CUST")%>
                                </td>
                                <td width="70px">
                                    <%#Eval("CARRCODE")%>
                                </td>
                                <td width="70px">
                                    <%#Eval("CTRNAME")%>
                                </td>
                                <td width="90px">
                                    <%#Eval("TOP")%>
                                </td>
                                <td width="70px">
                                    <%#Eval("STATUS")%>
                                </td>
                                <td>
                                    <%#Eval("NOTE")%>
                                </td>
                                <td width="70" align="center">
                                    <%#Eval("REPORT")%>
                                </td>
                                <%if (Request.QueryString["action"] != "export")
                                  { %>
                                <td width="70" align="center">
                                    <%#Eval("ACTION")%>
                                </td>
                                <%} %>
                            </tr>
                        </ItemTemplate>
                        <HeaderTemplate>
                            <div style="">
                                <table editcellcontent="true" cellspacing="0" cellpadding="0" width="auto" border="0"
                                    class="adminlist">
                                    <thead>
                                        <tr>
                                            <th>INDEX
                                            </th>
                                            <th align="center">FILE NO.
                                            </th>
                                            <%-- <th align="center">
                                            M.BKG NO. Số booking hãng tàu
                                        </th>--%>
                                            <th align="center">MBL NO.<%--Sô vận đơn hãng tàu--%>
                                            </th>
                                            <th align="center">TYPE. BILL .<%--Loai Bill --%>
                                            </th>
                                            <th align="center">VOL
                                            </th>
                                            <th align="center">POL
                                            <%-- 11. POL--%>
                                            </th>
                                            <th align="center">DEST.<%--14. DEST.--%>
                                            </th>
                                            <th align="center">ON BOARD.
                                            <%--12. SH.ON BOARD--%>
                                            </th>
                                            <th align="center">ETA
                                            </th>
                                            <%-- <th align="center">
                                            HBL NO. Số vận đơn BV
                                        </th>--%>
                                            <th align="center">CUST<%--depending POL or POD--%>
                                            </th>
                                            <th align="center">CARRIER
                                            </th>
                                            <th align="center">BKG PARTY
                                            <%--CTR.NAME--%>
                                            </th>
                                            <th align="center">TOP
                                            </th>
                                            <th align="center">STATUS
                                            </th>
                                            <th align="center">NOTE
                                            </th>
                                            <%if (Request.QueryString["action"] != "export")
                                              { %>
                                            <th colspan="2">ACTION
                                            </th>
                                            <%} %>
                                        </tr>
                                    </thead>
                        </HeaderTemplate>
                        <FooterTemplate>
                            <% if (strTotalGroupContType.Length > 0)
                               {%>
                            <tr>
                                <td colspan="4" style="font-weight: bold;">Tổng cộng
                                </td>
                                <td colspan="15" style="font-weight: bold;">
                                    <%=strTotalGroupContType%>
                                </td>
                            </tr>
                            <%} %>
                        </TABLE> </div>
                        </FooterTemplate>
                    </asp:Repeater>
                    <div class="clear">
                    </div>
                    <div id="footer">
                        <%=strPager%>
                    </div>
                </form>
            </div>
        </div>
    </div>
</body>
</html>
